window.arcToCurves = function (t, n, r, e, o, i, u, c, a) {
  if (!r || !e) return [];
  (c -= t), (a -= n), (r = Math.abs(r)), (e = Math.abs(e));
  var f = -c / 2,
    s = -a / 2,
    l = Math.cos((o * Math.PI) / 180);
  o = l * f + (x = Math.sin((o * Math.PI) / 180)) * s;
  var p = (f = -1 * x * f + l * s) * f,
    v = r * r,
    d = e * e,
    g = (s = o * o) / v + p / d;
  1 < g
    ? ((r *= Math.sqrt(g)), (e *= Math.sqrt(g)), (i = 0))
    : ((g = 1),
      i === u && (g = -1),
      (i = g * Math.sqrt((v * d - v * p - d * s) / (v * p + d * s)))),
    (c = l * (s = (i * r * f) / e) - x * (p = (-1 * i * e * o) / r) + c / 2),
    (a = x * s + l * p + a / 2),
    (i =
      0 <= (v = Math.atan2((f - p) / e, (o - s) / r) - Math.atan2(0, 1))
        ? v
        : 2 * Math.PI + v),
    (o =
      0 <=
      (v =
        Math.atan2((-f - p) / e, (-o - s) / r) -
        Math.atan2((f - p) / e, (o - s) / r))
        ? v
        : 2 * Math.PI + v),
    0 == u && 0 < o
      ? (o -= 2 * Math.PI)
      : 0 != u && 0 > o && (o += 2 * Math.PI),
    (u = (2 * o) / Math.PI),
    (o /= u = Math.ceil(0 > u ? -1 * u : u)),
    (f = ((8 / 3) * Math.sin(o / 4) * Math.sin(o / 4)) / Math.sin(o / 2)),
    (s = l * r),
    (l *= e),
    (r *= x),
    (e *= x);
  var h = Math.cos(i),
    y = Math.sin(i);
  (p = -f * (s * y + e * h)), (v = -f * (r * y - l * h));
  for (var x = [], b = 0; b < u; ++b) {
    (i += o),
      (d = s * (h = Math.cos(i)) - e * (y = Math.sin(i)) + c),
      (g = r * h + l * y + a);
    var m = -f * (s * y + e * h);
    (h = -f * (r * y - l * h)),
      (x[(y = 6 * b)] = Number(p + t)),
      (x[y + 1] = Number(v + n)),
      (x[y + 2] = Number(d - m + t)),
      (x[y + 3] = Number(g - h + n)),
      (x[y + 4] = Number(d + t)),
      (x[y + 5] = Number(g + n)),
      (p = d + m),
      (v = g + h);
  }
  return x;
};
